<template>
  <div class="home-card">
    <div class="home-card-inner">
      <div class="user-info">
        <div class="avatar-wrapper">
          <image-view
            src="https://www.youbaobao.xyz/mpvue-res/logo.jpg"
            round
          />
        </div>
        <div class="nickname">{{ '米老鼠' }}</div>
        <div class="shelf-text">书架共有{{3}}本好书</div>
        <div class="round-item" />
        <div class="shelf-text">特别精选</div>
      </div>
      <div class="book-info">
        <div class="book-wrapper">
          <div class="book-img-wrapper">
            <image-view
              src="https://www.youbaobao.xyz/book/res/img//EarthSciences/978-981-10-3713-9_CoverFigure.jpg"
            />
          </div>
          <div class="book-img-wrapper">
            <image-view
              src="https://www.youbaobao.xyz/book/res/img//EarthSciences/978-981-10-3713-9_CoverFigure.jpg"
            />
          </div>
          <div class="book-img-wrapper">
            <image-view
              src="https://www.youbaobao.xyz/book/res/img//EarthSciences/978-981-10-3713-9_CoverFigure.jpg"
            />
          </div>
        </div>
        <div class="shelf-wrapper">
          <div class="shelf">
            书架
          </div>
          <van-icon
            class="arrow"
            name="arrow"
            size="12px"
            color="#828489"
          />
        </div>
      </div>
      <div class="feedback-wrapper" @click="onFeedBackClick">
        反馈
      </div>
      <van-dialog id="van-dialog"></van-dialog>
    </div>
  </div>
</template>

<script>
import ImageView from '../../base/ImageView'
import Dialog from 'vant-weapp/dist/dialog/dialog'
export default {
  components: {
    ImageView
  },
  props: {
    data: Object,
    hasSign: {
      type: Boolean,
      default: false
    },
    signDay: {
      type: Number,
      default: 0
    }
  },
  methods: {
    gotoShelf () {},
    onBookClick () {},
    sign () {},
    onFeedBackClick () {
      Dialog.confirm({
        title: '反馈',
        message: '您是否确认提交反馈信息',
        confirmButtonText: '是',
        cancelButtonText: '否'
      }).then(() => {
        console.log('点击是之后的事件')
      }).catch(() => {
        console.log('点击否之后的事件')
      })
    }
  }
}
</script>

<style scoped lang="scss">
.home-card {
  background-image: linear-gradient(-90deg, #54575F 0%, #595b60 100%);
  border-radius: 10px;
  margin: 22px 20px 0;
  .home-card-inner {
    padding: 21.5px 17px 20px 20px;
    box-sizing: border-box;
    position: relative;
    .user-info {
      display: flex;
      align-items: center;
      .avatar-wrapper {
        width: 20px;
        height: 20px;
      }
      .nickname, .shelf-text {
        color: #ffffff;
        font-size: 12px;
      }
      .nickname {
        margin: 0 8.5px;
      }
      .shelf-text {
        opacity: 0.7;
      }
      .round-item {
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background-color: #a2a2a2;
        margin: 0 8px;
      }
    }
    .book-info {
      display: flex;
      margin-top: 16.5px;
      .book-wrapper {
        display: flex;
        flex: 1;
        justify-content: space-around;
        .book-img-wrapper {
          width: 72px;
          height: 101px;
        }
      }
      .shelf-wrapper {
        display: flex;
        align-items: center;
        .shelf {
          width: 12px;
          font-size: 12px;
          word-break: break-word;
          color: #ffffff;
          opacity: 0.8;
        }
      }
    }
    .feedback-wrapper {
      position: absolute;
      right: 0;
      top: 19.5px;
      z-index: 1;
      width: 44.4px;
      height: 23.5px;
      line-height: 23.5px;
      text-align: center;
      border-radius: 100px 0 0 100px;
      background: #707070;
      font-size: 12px;
      color: #ffffff;
    }
  }
}
</style>
